using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Localization;
using DotNetNuke.Services.Exceptions;
using gdlmo.DNN.Modules.Dept.Business;

namespace gdlmo.DNN.Modules.Dept
{
	public abstract class Settings : DotNetNuke.Entities.Modules.ModuleSettingsBase
	{
		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{

		}
		#endregion

		public override void LoadSettings()
		{
			try 
			{
				if (!Page.IsPostBack) 
				{
					string setting1 = ((string)TabModuleSettings["settingname1"]);
					string setting2 = ((string)Settings["settingname2"]);
				}
			} 
			catch (Exception exc) 
			{
				Exceptions.ProcessModuleLoadException(this, exc);
			}
		}

		public override void UpdateSettings()
		{
			try 
			{
				DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
				objModules.UpdateTabModuleSetting(TabModuleId, "settingname1", "value");
				objModules.UpdateModuleSetting(ModuleId, "settingname2", "value");
				Response.Redirect(Globals.NavigateURL(), true);
			} 
			catch (Exception exc) 
			{
				Exceptions.ProcessModuleLoadException(this, exc);
			}
		}
	}
}
